package com.efuture.servlet.request.forwarding;

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;

/**
 * @description: 请求转发演示
 * @author zhaoshanshan
 * @date 2021/10/2 11:51 下午
 * @version 1.0
 */
@WebServlet("/RequestForwardingTest")
public class RequestForwardingTest extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        System.out.println("RequestForwardingTest被访问了");
        //将请求转发
        request.getRequestDispatcher("/RequestForwardingTestTwo").forward(request,response);

    }
}
